<?php
class Controller extends Smarty
{
	public function __construct()
	{
		$this->setTemplateDir('./views')
       ->setCompileDir('./runtime/views_c')
       ->setConfigDir('./configs')
       ->setCacheDir('./runtime/caches');
	// 配置 模版变量的定界符
	$this->left_delimiter = LEFT_D;
	$this->right_delimiter = RIGHT_D;
	// 配置 缓存的控制
	$this->caching = CACHING;
	$this->cache_lifetime = CACHE_LIFETIME;
	}
public function redirect($message,$url = null)
{
	echo "<script>alert('{$message}')</script>";
	if(empty($url)){
		echo "<script>history.back()</script>";
	}else{
		echo "<script>location.href='{$url}'</script>";
	}
}
public function __call($fun,$params)
{
	header("HTTP/1.0 404not found");
	echo '<h1>来自于控制器的404 NOT FOUND</h1>';
	exit;
}
}

?>